package com.bytedance.scenedemo.benchmark;

import com.bytedance.scene.group.UserVisibleHintGroupScene;
import com.bytedance.scene.ktx.SceneExtensions;
import com.bytedance.scenedemo.ResourceTable;
import com.bytedance.scenedemo.benchmark.performance.PerformanceDemo;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.agp.components.ComponentContainer;
import ohos.agp.components.LayoutScatter;
import ohos.agp.components.Text;

/**
 * 导航
 */
public class BenchmarkSamples extends UserVisibleHintGroupScene implements Component.ClickedListener{
    @Override
    public ComponentContainer onCreateView(LayoutScatter layoutScatter, ComponentContainer container, Intent savedInstanceState) {
        Component layout=layoutScatter.parse(ResourceTable.Layout_fraction_benchmark_samples,container,false);
        Text textHint= (Text) layout.findComponentById(ResourceTable.Id_text_benchmark_sample_hint);
        Button btnPushPop= (Button) layout.findComponentById(ResourceTable.Id_btn_benchmark_sample);

        textHint.setText(BenchmarkSamples.class.getName());
        btnPushPop.setClickedListener(this);

        return (ComponentContainer) layout;
    }

    @Override
    public void onClick(Component component) {
        switch (component.getId()){
            case ResourceTable.Id_btn_benchmark_sample:
                SceneExtensions.requireNavigationScene(this).push(PerformanceDemo.class);
                break;
            default:
        }
    }
}
